<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>图片切换</title>
	</head>
	<body>
		<img id="imgId" src="./img/图片切换/1.jpg" >
		<button type="button" onclick="start(event);">开始</button>
	</body>
	<script type="text/javascript">
		function start(event){
			event.target.innerText = '抽奖...';
			var imgall = document.getElementById('imgId');
				setInterval(function(){
					var randNum = getrandNum();
					imgall.src = './img/图片切换/'+randNum+'.jpg'
				},200)
			
		}
			
		function getrandNum(){
			while(true){
				var randNum = Math.floor(Math.random()*10);
				if(randNum!=0){
					return randNum;
				}
			}
		}
	</script>
</html>
